package it.amicosmanettone.finance.stocky;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.support.v4.app.NavUtils;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Build;

public class InformationActivity extends Activity {
	
	Button buttonFacebook;
	Button buttonTwitter;
	Button buttonGoogle;
	Button buttonAmicosmanettone;
	TextView textHead;
	TextView textBottom;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_information);
		
		 Typeface college = Typeface.createFromAsset(getAssets(), "Colleged.ttf");
		 Typeface lino = Typeface.createFromAsset(getAssets(), "linowrite.ttf");
		
		
		this.buttonFacebook = (Button) findViewById(R.id.buttonFacebook);
		this.buttonTwitter = (Button) findViewById(R.id.buttonTwitter);
		this.buttonGoogle = (Button) findViewById(R.id.buttonGoogle);
		this.buttonAmicosmanettone = (Button) findViewById(R.id.buttonAmicosmanettone);
		this.textHead = (TextView) findViewById(R.id.textInformationHead);
		this.textBottom = (TextView) findViewById(R.id.textInformationBottom);
		
		textHead.setTypeface(college);
		textHead.refreshDrawableState();
		textBottom.setTypeface(lino);
		textBottom.refreshDrawableState();
		
		this.buttonFacebook.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				
				String urlFacebook = "https://www.facebook.com/pages/AmicoSmanettoneit/343874855644946";
				Intent i = new Intent(Intent.ACTION_VIEW);
				i.setData(Uri.parse(urlFacebook));
				startActivity(i);
				
			}
		});
		
		this.buttonTwitter.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				
				String urlTwitter = "https://twitter.com/AmicoSmanettone";
				Intent i = new Intent(Intent.ACTION_VIEW);
				i.setData(Uri.parse(urlTwitter));
				startActivity(i);
				
			}
		});
		
		this.buttonGoogle.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				
				String urlGoogle = "https://plus.google.com/116985865329983226764/posts";
				Intent i = new Intent(Intent.ACTION_VIEW);
				i.setData(Uri.parse(urlGoogle));
				startActivity(i);
				
			}
		});
		
		this.buttonAmicosmanettone.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				
				String urlAmicosmanettone = "https://www.amicosmanettone.it";
				Intent i = new Intent(Intent.ACTION_VIEW);
				i.setData(Uri.parse(urlAmicosmanettone));
				startActivity(i);
				
			}
		});
		
		setupActionBar();
	}


	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	private void setupActionBar() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			getActionBar().setDisplayHomeAsUpEnabled(true);
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
		
			NavUtils.navigateUpFromSameTask(this);
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

}
